﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Text;
using System.Threading.Tasks;
using DHQGHN.DAL.Base;
using DHQGHN.DAL.Common;
using DHQGHN.DAL.DAO.Metadata;
using DHQGHN.DAL.Models.Metadata;
using DHQGHN.Common;

namespace DHQGHN.DAL.BO.Metadata
{
    public class DataBO : BaseBO
    {

        public String _connectionString;
        private DataDAO _shareDAO;

        public DataBO()
        {
            this._connectionString = DEFAULT_CONN_STRING;

        }
        public DataBO(String connectionString)
        {
            this._connectionString = connectionString;
        }


        public DataPage<DataRow> GetAllData(string databaseName, string tableName, int pageIndex, int pageSize)
        {
            try
            {
                _shareDAO = new DataDAO(_connectionString, DEFAULT_MAPPER_TYPE);
                return _shareDAO.GetAllData(databaseName, tableName, pageIndex, pageSize);
            }
            catch (Exception)
            {
                throw;
            }
        }

        public DataTable GetTop10Data(string databaseName, string tableName)
        {
            try
            {
                _shareDAO = new DataDAO(_connectionString, DEFAULT_MAPPER_TYPE);
                return _shareDAO.GetTop10Data(databaseName, tableName);
            }
            catch (Exception)
            {
                throw;
            }
        }

    }
}
